package br.com.dev.tcc.singleton;

import br.com.dev.tcc.bean.Apolice;
import br.com.dev.tcc.bean.sinistro.Sinistro;
import br.com.dev.tcc.bean.sinistro.TipoSinistro;

public class SinistroSingleton {

	private static Sinistro instance;

	private SinistroSingleton() {
		// singleton
	}

	public static Sinistro getInstance() {

		if (instance == null)
			instance = new Sinistro();

		return instance;
	}

	public static void flushInstance() {
		TipoSinistro tipoSinistro = instance.getTipo();
		Apolice apolice = instance.getApolice();
		
		instance = new Sinistro();
		instance.setApolice(apolice);
		instance.setTipo(tipoSinistro);
		instance.setId(2);
	}
}
